﻿using AgencyManagerSystem.Model;
using System.Linq;

namespace AgencyManagerSystem.DataFetcher
{
    public class CombinationFetcher : BaseFetcher<CombinationModel>
    {
        public CombinationFetcher() : base()
        {

        }
        public CombinationModel GetByCode(string code)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "Code", Op = "=", Value = code } };
            var list = List(conditions);
            if (list.Count > 0)
                return list.First();
            else
                return null;
        }

        public CombinationModel GetByProduction(int production)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "Production", Op = "=", Value = production } };
            var list = List(conditions);
            if (list.Count > 0)
                return list.First();
            else
                return null;
        }
    }
}
